package com.software.seakdream.controller;


import com.software.seakdream.domain.Result;
import com.software.seakdream.entity.LullabyInfo;
import com.software.seakdream.service.LullabyInfoService;
import com.software.seakdream.utils.ResultUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/LullabyInfo")
public class LullabyInfoController {

    @Autowired
    private LullabyInfoService lullabyInfoService;

    @GetMapping("/queryLullabyInfo")
    public Result queryLullabyByType (String type) {
        List<LullabyInfo> query = lullabyInfoService.queryLullabyByType(type);
        if (query == null){
            return ResultUtils.error("404","找不到lullaby", null);
        }
        return ResultUtils.success(query);
    }
}
